﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MMDemo
{
    public partial class LinearInitForm : Form
    {
        public LinearInitForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string data = textBox1.Text.Trim();
            if (data == "")
            {
                MessageBox.Show("请输入数据!");
            }
            else if (data.Length>8)
            {
                MessageBox.Show("数据输入个数太多,最多输入8个！");
            }
            else
            {
                PublicDataClass.InitData = data;
                PublicDataClass.IsInit = true;
                this.Close();
            }
        }
        /// <summary>
        /// 得到textbox的值
        /// </summary>
        public String GetData()
        {
            return textBox1.Text.Trim();
        }
        /// <summary>
        /// 修改标签的名字
        /// </summary>
        public void ChangeLabelText(String text)
        {
            label1.Text = text;
        }
        public void ChangeTextValue(String value)
        {
            textBox1.Text = value;
        }
        public String GetTextValue()
        {
            return textBox1.Text.Trim();
        }

        protected override void WndProc(ref   Message m)
        {
            const int WM_SYSCOMMAND = 0x0112;
            const int SC_CLOSE = 0xF060;
            if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
            {
                PublicDataClass.IsInit = false;
                this.Close();
                return;
            }
            base.WndProc(ref m);
        }
    }
}
